$OpenBSD: patch-ksysguard_ksysguardd_OpenBSD_ProcessList_c,v 1.3 2014/07/10 13:15:22 sthen Exp $
Adapt to new OpenBSD kinfo_proc API.
--- ksysguard/ksysguardd/OpenBSD/ProcessList.c.orig	Sun Apr 27 22:38:04 2014
+++ ksysguard/ksysguardd/OpenBSD/ProcessList.c	Thu Jul 10 07:02:49 2014
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <sys/time.h>
@@ -155,7 +156,7 @@ findProcessInList(int pid)
 }
 
 static void
-fillProcessCmdline(char *cmdline, struct kinfo_proc2 *p, size_t maxlen)
+fillProcessCmdline(char *cmdline, struct kinfo_proc *p, size_t maxlen)
 {
 	int mib[4];
 	int ret = -1;
@@ -204,7 +205,7 @@ fillProcessCmdline(char *cmdline, struct kinfo_proc2 *
 }
 
 static int
-updateProcess(struct kinfo_proc2 *p)
+updateProcess(struct kinfo_proc *p)
 {
 	static const char * const statuses[] = { "idle","run","sleep","stop","zombie" };
 	
@@ -317,14 +318,14 @@ updateProcessList(void)
         int mib[6];
         size_t len;
         size_t num;
-        struct kinfo_proc2 *p;
+        struct kinfo_proc *p;
 
 
         mib[0] = CTL_KERN;
-        mib[1] = KERN_PROC2;
+        mib[1] = KERN_PROC;
         mib[2] = KERN_PROC_ALL;
 	mib[3] = 0;
-	mib[4] = sizeof(struct kinfo_proc2);
+	mib[4] = sizeof(struct kinfo_proc);
 	mib[5] = 0;
         if (sysctl(mib, 6, NULL, &len, NULL, 0) == -1)
 		return 0;
@@ -332,11 +333,11 @@ updateProcessList(void)
 	p = malloc(len);
 	if (!p)
 		return 0;
-	mib[5] = len/ sizeof(struct kinfo_proc2);
+	mib[5] = len/ sizeof(struct kinfo_proc);
         if (sysctl(mib, 6, p, &len, NULL, 0) == -1)
 		return 0;
 
-	for (num = 0; num < len / sizeof(struct kinfo_proc2); num++)
+	for (num = 0; num < len / sizeof(struct kinfo_proc); num++)
 		updateProcess(&p[num]);
 	free(p);
 	cleanupProcessList();
